//package com.example.beryl;
//
//import android.content.Context;
//import android.os.Bundle;
//import android.os.Message;
//
//import androidx.test.platform.app.InstrumentationRegistry;
//import androidx.test.ext.junit.runners.AndroidJUnit4;
//
//import org.junit.Test;
//import org.junit.runner.RunWith;
//
//import static org.junit.Assert.*;
//
//import com.example.beryl.entity.Customer;
//import com.example.beryl.http.Net_LogMethod;
//import com.google.gson.Gson;
//import com.kingdee.bos.webapi.sdk.BatchSave;
//import com.kingdee.bos.webapi.sdk.CfgUtil;
//import com.kingdee.bos.webapi.sdk.InvokeMode;
//import com.kingdee.bos.webapi.sdk.K3CloudApi;
//import com.kingdee.bos.webapi.sdk.QueryParam;
//import com.kingdee.bos.webapi.sdk.QueryResultInfo;
//import com.kingdee.bos.webapi.sdk.SaveParam;
//import com.kingdee.bos.webapi.sdk.SaveResult;
//
//import java.io.File;
//import java.io.IOException;
//import java.io.InputStream;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.UUID;
//
///**
// * Instrumented test, which will execute on an Android device.
// *
// * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
// */
//@RunWith(AndroidJUnit4.class)
//public class ExampleInstrumentedTest {
//    @Test
//    public void useAppContext() {
//        // Context of the app under test.
//        Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
//        assertEquals("com.example.beryl", appContext.getPackageName());
//    }
//
//    @Test
//    public void testGson() {
//
//        Gson gson = new Gson();
//        String json = "{\"TaskId\":\"7\",\"Status\":2,\"Result\":{\"Result\":{\"ResponseStatus\":{\"IsSuccess\":true,\"Errors\":[],\"SuccessEntitys\":[{\"Id\":100082,\"Number\":\"BC20190914023210001\",\"DIndex\":0},{\"Id\":100083,\"Number\":\"BC20190914023310002\",\"DIndex\":1},{\"Id\":100084,\"Number\":\"BC20190914023310003\",\"DIndex\":2},{\"Id\":100085,\"Number\":\"BC20190914023310004\",\"DIndex\":3},{\"Id\":100086,\"Number\":\"BC20190914023310005\",\"DIndex\":4},{\"Id\":100087,\"Number\":\"BC20190914023310006\",\"DIndex\":5},{\"Id\":100088,\"Number\":\"BC20190914023310007\",\"DIndex\":6},{\"Id\":100089,\"Number\":\"BC20190914023310008\",\"DIndex\":7},{\"Id\":100090,\"Number\":\"BC20190914023310009\",\"DIndex\":8},{\"Id\":100091,\"Number\":\"BC20190914023310010\",\"DIndex\":9},{\"Id\":100092,\"Number\":\"BC20190914023310011\",\"DIndex\":10},{\"Id\":100093,\"Number\":\"BC20190914023310012\",\"DIndex\":11},{\"Id\":100094,\"Number\":\"BC20190914023310013\",\"DIndex\":12},{\"Id\":100095,\"Number\":\"BC20190914023310014\",\"DIndex\":13},{\"Id\":100096,\"Number\":\"BC20190914023310015\",\"DIndex\":14},{\"Id\":100097,\"Number\":\"BC20190914023310016\",\"DIndex\":15},{\"Id\":100098,\"Number\":\"BC20190914023310017\",\"DIndex\":16},{\"Id\":100099,\"Number\":\"BC20190914023310018\",\"DIndex\":17},{\"Id\":100100,\"Number\":\"BC20190914023310019\",\"DIndex\":18},{\"Id\":100101,\"Number\":\"BC20190914023310020\",\"DIndex\":19}],\"SuccessMessages\":[],\"MsgCode\":0},\"NeedReturnData\":[]}},\"Cancelled\":false,\"IsFaulted\":false,\"FaultedException\":null,\"ProgressInfos\":null,\"Successful\":true,\"Message\":\"\",\"Progress\":100,\"ProgressDesc\":\"\"}";
//        QueryResultInfo ret = gson.fromJson(json, QueryResultInfo.class);
//        String oStr = gson.toJson(ret.getResult());
//        System.out.println(oStr);
//
//    }
//
//    @Test
//    public void testSaveCustomer() throws Exception {
//        K3CloudApi api=new K3CloudApi();
//        Customer c = new Customer();
//        c.setFNumber(SeqHelper.genNumber("BC"));
//        c.setFName("aimin_ï¿½Í»ï¿½ï¿½ï¿½ï¿½ï¿½-A" + UUID.randomUUID().toString());
//        c.setFShortName("aimin_ï¿½Í»ï¿½ï¿½ï¿½ï¿?-A" + UUID.randomUUID().toString());
//        SaveResult sRet = api.save("BD_Customer", new SaveParam<Customer>(c));
//        if (sRet.isSuccessfully()) {
//            Gson gson = new Gson();
//            System.out.println(
//                    String.format("%s", gson.toJson(sRet.getResult().getResponseStatus().getSuccessEntitys())));
//        } else {
//            fail("dcs is null!");
//        }
//
//    }
//
//    /*ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½Í»ï¿½ï¿½ï¿½Ï?*/
//    @Test
//    public void testBatchSaveCustomer() throws Exception {
//        K3CloudApi api=new K3CloudApi();
//        List<Customer> custs = new ArrayList<Customer>();
//        for (int i = 0; i < 10; i++) {
//            Customer c = new Customer();
//            c.setFNumber(SeqHelper.genNumber("BC"));
//            c.setFName("zam_ï¿½Í»ï¿½ï¿½ï¿½ï¿½ï¿½-ï¿½ï¿½ï¿½ï¿½" + UUID.randomUUID().toString());
//            c.setFShortName("zam_ï¿½Í»ï¿½ï¿½ï¿½ï¿?-ï¿½ï¿½ï¿½ï¿½" + UUID.randomUUID().toString());
//            custs.add(c);
//        }
//
//        // ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½Í»ï¿½ï¿½ï¿½Ï?
//        SaveResult sRet = api.batchSave("BD_Customer", new BatchSave<Customer>(custs), InvokeMode.Query);
//
//        if (sRet.isSuccessfully()) {
//            Gson gson = new Gson();
//            for (int i = 0; i < custs.size(); i++)
//                System.out.println(String.format("get(%s)=%s", i,
//                        gson.toJson(sRet.getResult().getResponseStatus().getSuccessEntitys().get(i))));
//        } else {
//            fail("dcs is null!");
//        }
//    }
//
//    /*ï¿½ï¿½ï¿½ï¿½Ñ¯ï¿½Ó¿Ú£ï¿½ï¿½ï¿½Ñ¯ï¿½Í»ï¿½ï¿½ï¿½Ï¢*/
//    @Test
//    public void testQueryCustomer() throws IOException {
//        File file = null;
//        file = new File((new File(".")).getCanonicalPath() + "/kdwebapi.properties");
//
//        if (!file.exists())
//        {
//            InputStream inputStream = ClassLoader.getSystemResourceAsStream("kdwebapi.properties");
//        }
//        K3CloudApi api = new K3CloudApi();
//        List<Customer> datas = null;
//        try {
//            datas = api.executeBillQuery(
//                    new QueryParam().setFormId("BD_Customer").setFieldKeys("FCUSTID,FNumber,FName,FCreateDate"),
//                    Customer.class);
//            if (datas != null) {
//                Customer meta = ((Customer) (datas.toArray()[0]));
//                System.out.println(String.format("%s", new Gson().toJson(meta)));
//            } else {
//                fail("datas is null!");
//            }
//        } catch (Exception e) {
//
//            fail(e.getMessage());
//            System.out.println(e.getMessage());
//        }
//
//        if (datas != null) {
//            System.out.println(String.format("Total:%s", datas.size()));
//        } else {
//            fail("dcs is null!");
//        }
//    }
//
//    @Test
//    public void test()
//    {
//        Runnable run = new Runnable() {
//            @Override
//            public void run() {
//                String ret = Net_LogMethod.Query();
//            }
//        };
//        new Thread(run).start();
//    }
//
//
//}